/* ==========================================================================
   TOGGLE
   ========================================================================== */

.toggle-fieldtype-wrapper {
    height: 32px;
    display: flex;
    align-items: center;
    &:focus-within .toggle-container {
        @apply ring-2;
    }

    .inline-label {
        @apply rtl:mr-2 ltr:ml-2 font-normal text-gray-700 dark:text-dark-175;
        a {
            @apply text-gray-800 dark:text-dark-150 underline;
            &:hover {
                @apply text-blue;
            }
        }
    }
}

.locale-status-field .toggle-fieldtype-wrapper {
    height: auto;
    display: inline-block;
}

.toggle-container {
    @apply bg-white dark:bg-dark-700 cursor-pointer relative border dark:border-dark-900 shrink-0;
    height: 22px;
    width: 46px;
    border-radius: 20px;
    font-size: 0.1px;
    margin: 6px 0;
    transition: background-color 0.2s ease;
    &:focus { outline: none; }
}

.toggle-slider {
    position: absolute;
    top: -1px;
    width: 20px;
    height: 20px;
    border-radius: 20px;
    transition: all 0.2s ease;

    &.disabled {
        cursor: not-allowed;
    }
}

.toggle-knob {
    @apply absolute top-px outline-none bg-white rounded-full;
    right: 0 ; [dir="rtl"] & { right: auto ; left: 0 ; }
    width: 20px;
    height: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    transition: box-shadow 0.1s, background-color 0.2s ease-in-out;

    .dark & {
        background: theme(colors.dark.500);
    }
}

.toggle-knob:hover {
    box-shadow: 0 1px 3px rgba(theme('colors.blue.DEFAULT'), .9);
}

.toggle-container.on {
    @apply bg-green-500 border-green-600;
    .toggle-slider {
        width: 44px;
    }

    .toggle-knob:focus {
        box-shadow: 0 0 10px theme(colors.green.500/70);
        .dark & {
            box-shadow: none;
        }
    }
}

.toggle-container.on.read-only {
    @apply bg-gray-500 border-gray-600;

    .toggle-knob:focus {
        box-shadow: 0 0 10px theme(colors.gray.500/70);
    }
}

/* Size Variants
  ========================================================================== */
.toggle-sm.toggle-fieldtype-wrapper {
    height: 16px;

    .toggle-container {
        height: 12px;
        width: 21px;
    }

    .toggle-knob {
        width: 10px;
        height: 10px;
    }

    .toggle-slider {
        box-shadow: inset 0 1px rgba(0,0,0,.25);
        height: 12px;
        width: 10px;
    }

    .toggle-container.on .toggle-slider {
        width: 19px;
    }
}

/* Inside the Sidebar
  ========================================================================== */
.publish-sidebar .toggle-fieldtype {
    @apply flex items-center justify-between flex-wrap;
    .field-inner > label { margin: 0; }
    .toggle-fieldtype-wrapper { margin-left: 8px ; [dir="rtl"] & { margin-right: 8px ; margin-left: 0 ; } }
    .help-block { margin-top: 4px !important; }
}

/* Inside a Grid field
  ========================================================================== */

.grid-table td.toggle-fieldtype {
    padding-top: 14px;
}
